import axios from 'axios';
import { url } from '.';

export const getAll = async (data) =>{
    let res = await axios({
        method:"get",
        url: url + '/order',
        params:data
    });
    return res.data;
}

export const add = async (data) =>{
    let res = await axios({
        method:"post",
        url: url + '/order',
        data
    });
    return res.data;
}

export const remove = async (data) =>{
    let res = await axios({
        method:"delete",
        url: url + `/order/${data}`
    });
    return res.data;
}

export const getOne = async (data) =>{
    console.log(data);
    let res = await axios({
        method:"get",
        url: url + '/order/getOne/'+data
    })
    return res.data;
}

export const update = async (data) =>{
    let res = await axios({
        method:"put",
        url: url + '/order/'+data._id,
        data
    })
    return res.data;
}

export const upload = async (data) =>{
    console.log(data);
    let res = await axios({
        method:"post",
        url: url + '/upload',
        data
    })
    return res.data;
}

export const snapId = async (data) =>{
    console.log(data);
    let res = await axios({
        method:"get",
        url: url + '/order/'+data
    })
    return res.data;
}